<template>
	<view class="steps">
			<!-- {{'a'+active}}{{'s'+status}} -->
		<view class="step_item" v-for="(item, index) in list" :key="index" :style="{width:itemWidth+'rpx'}">
			<view class="content flex">
				  <image :src="stepIcon[index]" mode="" v-if="active>=index"></image>
				<view v-else>
					<view class="circle">
					</view>
				</view>
				<text :style="{ color: active >= index ? '#0091ff' : '#ccc' }">{{ item.title }}</text>
				
			</view>
			<view v-if="index!==list.length-1">
				<view class="line" :style="{ background: active > index ? '#0091ff' : '#ccc', left: active>= 0 ? ((itemWidth/2)-12)+'rpx' : (itemWidth/2)+'rpx' }"></view>
				<!-- <view class="line"  :style="{ background: active > index ? '#0091ff' : '#ccc', left: active>= 0 ? ((itemWidth/2)-12)+'rpx' : (itemWidth/2)+'rpx' }" v-else></view> -->
			</view>
		
		</view>
		
	</view>
</template>

<script>
export default {
	props: {
		list: {
			type: Array
		},
		// active 为索引值
		active: {
			type: Number
		},
		// 每个进度条item的宽度 默认260
		itemWidth:{
			type:Number,
			default:260
		},
		status:{
			type:Number
		},
		stepIcon:{
			type:Array
		}
	},
	computed: {
	},
	data() {
		return {
			
		};
	},
};
</script>

<style lang="scss" scoped>
.steps {
	display: flex;
	// padding-top: 20rpx;
	padding: 20rpx;
	justify-content: center;
	.step_item {
		display: flex;
		// background: pink;
		width: 260rpx;
		align-items: center;
		justify-content: center;
		position: relative;
		// border: 1rpx solid #ccc;
		text {
			margin-top: 8rpx;
		}
		.content {
			
			display: flex;
			flex-direction: column;
			
			padding: 0 20rpx;
			height: 100%;
			view {
				
				display: flex;
				flex: 1;
				align-items: center;
				.circle{
					width: 24rpx;
					height: 24rpx;
					background-color: #ccc;
					border-radius: 100%;
				}
			}
             text{
				 display: flex;
				 flex: 1;
				 align-items: flex-end;
			 }
			image {
				width: 48rpx;
				height: 48rpx;
				position: relative;
				z-index: 2;
			}
		}
		.line {
			// width: 226rpx;
			// height: 6rpx;
			display: flex;
			flex: 1;
			height: 4rpx;
			background-color: pink;
		    width: 100%;
			position: absolute;
			left: 0rpx;
			top: 20rpx;
		}
	}
}
</style>
